package com.neulogistics.contrib.warehouse.api.config;

import com.blackto.lib.eventbus.event.IntegrationEvent;
import com.neulogistics.contrib.warehouse.api.application.integrationevent.publish.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class IntegrationEventConfig {

    /**
     * 这里需要将项目中所有需要发布的集成事件类型添加到List中，
     * 只有为集成事件服务提供了事件类型，服务才能正确地将json转化化为对应事件
     */
    @Bean
    public List<Class<? extends IntegrationEvent>> eventType() {
        List<Class<? extends IntegrationEvent>> eventType = new ArrayList<>();

        eventType.add(InventoryCheckedIntegrationEvent.class);
        eventType.add(PickUpOutboundIntegrationEvent.class);
        eventType.add(PurchaseInboundIntegrationEvent.class);
        eventType.add(SubstationReturnInboundIntegrationEvent.class);
        eventType.add(TransferInboundIntegrationEvent.class);
        eventType.add(TransferOutboundIntegrationEvent.class);
        eventType.add(CenterReturnOutboundIntegrationEvent.class);

        return eventType;
    }
}
